package Collection;

import netscape.security.UserTarget;
import org.junit.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Hashsetdemo1 {
    @Test
    public void mehtod3(){
        Set<People> set=new HashSet<>();
        People hh = new People("hh");
        People hh1 = new People("hh");
        System.out.println(  set.add(hh));
        System.out.println(set.add(hh1));
        for (People people : set) {
            System.out.println(people);
        }
    }
    @Test
    public void mehtod1(){
        Set<String> set=new HashSet<>();
        String s1="hello";
        String s2=new String("world");
        String s3="java";
        String s4=new String("world");
        System.out.println(s2);
        System.out.println(s4);
//        System.out.println(s2==s4);
//        System.out.println(s1.hashCode());
//        System.out.println(s2.hashCode());
//        System.out.println(s3.hashCode());
//        System.out.println(s4.hashCode());
//        set.add(s1);
//        set.add(s2);
//        set.add(s3);
//        set.add(s4);
//        System.out.println(set);
    }

    @Test
    public void method2(){
        String s1=new String("张三");
        String s2=new String("李四");
        String s3=new String("张三");
        int i=s1.hashCode();
//        System.out.println(s1.hashCode());
//        System.out.println(s2.hashCode());
//        System.out.println(s3.hashCode());
//        System.out.println(s1.equals(s3));
//        System.out.println(s1==s3);
    }
}
